# 生成窗口
# import pygame
#
# pygame.init()
#
# # CREATING CANVAS
# canvas = pygame.display.set_mode((500, 500))
#
# # TITLE OF CANVAS
# pygame.display.set_caption("My Board")
# exit = False
#
# while not exit:
#     for event in pygame.event.get():
#         if event.type == pygame.QUIT:
#             exit = True
#     pygame.display.update()



# 窗口中添加图片
# import pygame
#
# pygame.init()
#
# color = (255, 255, 255)
# position = (0, 0)
#
# # CREATING CANVAS
# canvas = pygame.display.set_mode((500, 500))
#
# # TITLE OF CANVAS
# pygame.display.set_caption("Show Image")
#
# image = pygame.image.load("1.png")
# exit = False
#
# while not exit:
#     canvas.fill(color)
#     canvas.blit(image, dest=position)
#
#     for event in pygame.event.get():
#         if event.type == pygame.QUIT:
#             exit = True
#
#     pygame.display.update()




# 在窗口中绘制矩形框
# import pygame
#
# pygame.init()
#
# color = (255, 255, 255)
# rect_color = (255, 0, 0)
#
# # CREATING CANVAS
# canvas = pygame.display.set_mode((500, 500))
#
# # TITLE OF CANVAS
# pygame.display.set_caption("Show Image")
#
# image = pygame.image.load("1.png")
# exit = False
#
# while not exit:
#     canvas.fill(color)
#     for event in pygame.event.get():
#         if event.type == pygame.QUIT:
#             exit = True
#
#     pygame.draw.rect(canvas, rect_color,
#                      pygame.Rect(30, 30, 60, 60))
#     pygame.display.update()





# 跟随鼠标做圆
# import pygame
#
# # initializing the pygame
# pygame.init()
# # displaying Canvas (960*600)
# screen = pygame.display.set_mode((960, 600))
# pygame.display.set_caption('GeeksForGeeks')
# clock = pygame.time.Clock()
#
# loop = True
# while loop:
#
#     for event in pygame.event.get():
#         if event.type == pygame.QUIT:
#             loop = False
#     pos = pygame.mouse.get_pos()
#     # giving color and shape to the circle
#     pygame.draw.circle(screen, (0, 255, 0),
#                        pos, 15, 1)
#     pygame.display.update()
#     clock.tick(60)
#
# pygame.quit()
# # quit()





# 指向鼠标方向
# import pygame as pg
# from pygame.math import Vector2
#
#
# class Player(pg.sprite.Sprite):
#     # main function starts here
#     def __init__(self, pos):
#         super().__init__()
#         self.image = pg.Surface((50, 30),
#                                 pg.SRCALPHA)
#         pg.draw.polygon(self.image,
#                         pg.Color('steelblue2'),
#                         [(0, 0), (50, 15), (0, 30)])
#         self.orig_image = self.image
#         # Store a reference to the original.
#         self.rect = self.image.get_rect(center=pos)
#         self.pos = Vector2(pos)
#
#     def update(self):
#         self.rotate()
#
#     # Rotate the arrow function
#
#     def rotate(self):
#         # The vector to the target (the mouse position).
#         direction = pg.mouse.get_pos() - self.pos
#         # .as_polar gives you the polar
#         # coordinates of the vector,
#         # i.e. the radius (distance to the target)
#         # and the angle.
#         radius, angle = direction.as_polar()
#         # Rotate the image by the negative angle
#         # (y-axis in pygame is flipped).
#         self.image = pg.transform.rotate(self.orig_image,
#                                          -angle)
#         # Create a new rect with the
#         # center of the old rect.
#         self.rect = self.image.get_rect(center=self.rect.center)
#
#
# pg.init()
# # Creating a canvas of size 640*480
# screen = pg.display.set_mode((640, 480))
# clock = pg.time.Clock()
# all_sprites = pg.sprite.Group(Player((300, 220)))
# done = False
#
# while not done:
#     for event in pg.event.get():
#         if event.type == pg.QUIT:
#             done = True
#
#     all_sprites.update()
#     screen.fill((30, 30, 30))
#     all_sprites.draw(screen)
#
#     pg.display.flip()
#     clock.tick(30)





# 改变鼠标形状
# import pygame
#
# pygame.init()
#
# # Creating a canvas of 600*400
# screen = pygame.display.set_mode((600, 400))
# clock = pygame.time.Clock()
#
# # old type, "bitmap" cursor
# cursor1 = pygame.cursors.diamond
#
# # new type, "system" cursor
# cursor2 = pygame.SYSTEM_CURSOR_HAND
#
# # new type, "color" cursor
# surf = pygame.Surface((30, 25), pygame.SRCALPHA)
# pygame.draw.rect(surf, (0, 255, 0), [0, 0, 10, 10])
# pygame.draw.rect(surf, (0, 255, 0), [20, 0, 10, 10])
# pygame.draw.rect(surf, (255, 0, 0), [5, 5, 20, 20])
# cursor3 = pygame.cursors.Cursor((15, 5), surf)
#
# cursors = [cursor1, cursor2, cursor3]
# cursor_index = 0
#
# # the arguments to set_cursor can be a Cursor object
# # or it will construct a Cursor object
# # internally from the arguments
# pygame.mouse.set_cursor(cursors[cursor_index])
#
# while True:
#     screen.fill("purple")
#
#     for event in pygame.event.get():
#         if event.type == pygame.MOUSEBUTTONDOWN:
#             cursor_index += 1
#             cursor_index %= len(cursors)
#             pygame.mouse.set_cursor(cursors[cursor_index])
#
#         if event.type == pygame.QUIT:
#             pygame.quit()
#             raise SystemExit
#
#     pygame.display.flip()
#     clock.tick(144)





# 创建滚动窗口
# import math
# import pygame as py
#
# py.init()
#
# clock = py.time.Clock()
#
# FrameHeight = 600
# FrameWidth = 1200
#
# # PYGAME FRAME WINDOW
# py.display.set_caption("Endless Scrolling in pygame")
# screen = py.display.set_mode((FrameWidth,
#                               FrameHeight))
#
# # IMAGE
# bg = py.image.load("1.png").convert()
#
# # DEFINING MAIN VARIABLES IN SCROLLING
# scroll = 0
#
# # CHANGE THE BELOW 1 TO UPPER NUMBER IF
# # YOU GET BUFFERING OF THE IMAGE
# # HERE 1 IS THE CONSTATNT FOR REMOVING BUFFERING
# tiles = math.ceil(FrameWidth / bg.get_width()) + 1
#
# # MAIN LOOP
# while 1:
#     # THIS WILL MANAGE THE SPEED OF
#     # THE SCROLLING IN PYGAME
#     clock.tick(33)
#
#     # APPENDING THE IMAGE TO THE BACK
#     # OF THE SAME IMAGE
#     i = 0
#     while (i < tiles):
#         screen.blit(bg, (bg.get_width() * i
#                          + scroll, 0))
#         i += 1
#     # FRAME FOR SCROLLING
#     scroll -= 6
#
#     # RESET THE SCROLL FRAME
#     if abs(scroll) > bg.get_width():
#         scroll = 0
#     # CLOSINF THE FRAME OF SCROLLING
#     for event in py.event.get():
#         if event.type == py.QUIT:
#             quit()
#
#     py.display.update()
#
# py.quit()
# Python








# 获取当前文件工作目录
# # Python program to explain os.getcwd() method
#
# # importing os module
# import os
#
# # Get the current working
# # directory (CWD)
# cwd = os.getcwd()
#
# # Print the current working
# # directory (CWD)
# print("Current working directory:", cwd)




# 改变当前文件工作目录
# # Python program to change the
# # current working directory
#
#
# import os
#
#
# # Function to Get the current
# # working directory
# def current_path():
#     print("Current working directory before")
#     print(os.getcwd())
#     print()
#
#
# # Driver's code
# # Printing CWD before
# current_path()
#
# # Changing the CWD
# os.chdir('../')
#
# # Printing CWD after
# current_path()




# # 创建一个工作目录
# # Python program to explain os.mkdir() method
#
# # importing os module
# import os
#
# # Directory
# directory = "C:\\Users\\hp\\PycharmProjects.2"
#
# # Parent Directory path
# parent_dir = "-"
#
# # Path
# path = os.path.join(parent_dir, directory)
#
# # Create the directory
# # 'GeeksForGeeks' in
# # '/home / User / Documents'
# os.mkdir(path)
# print("Directory '% s' created" % directory)
#
# # Directory
# directory = "Geeks"
#
# # Parent Directory path
# parent_dir = "C:\\Users\\hp\\PycharmProjects\\cool-sheng-ink-dyeing"
#
# # mode
# mode = 0o666
#
# # Path
# path = os.path.join(parent_dir, directory)
#
# # Create the directory
# # 'GeeksForGeeks' in
# # '/home / User / Documents'
# # with mode 0o666
# os.mkdir(path, mode)
# print("Directory '% s' created" % directory)







